package com.sx.gongzhong.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sx.gongzhong.R;
import com.sx.gongzhong.model.MessageBean;

import java.util.List;

/**通知
 * Created by admin on 2018/1/3.
 */

public class MessageNotifyAdapter  extends BaseQuickAdapter<MessageBean,BaseViewHolder> {

    private Context context;

    public MessageNotifyAdapter(Context context, @LayoutRes int layoutResId, @Nullable List<MessageBean> data) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, final MessageBean item) {
        TextView textView =  helper.getView(R.id.tv_noread);
        if (item.readState){
            textView.setVisibility(View.GONE);
        }else {
            textView.setVisibility(View.VISIBLE);
        }
        helper.setText(R.id.tv_title,item.title);
        helper.setText(R.id.tv_content,item.content);
        switch (item.columnType){
            case "convenient_appeal": //诉求类型
                helper.setText(R.id.tv_type,"#便民诉求");
                break;
            case "broke_news"://爆料类型
                helper.setText(R.id.tv_type,"#爆料");
                break;
            case "help_each_other"://互帮互助
                helper.setText(R.id.tv_type,"#互帮互助");
                break;
            case "national_road_protection"://全民护路
                helper.setText(R.id.tv_type,"#全民护路");
                break;
            case "legal_advice"://法律咨询
                helper.setText(R.id.tv_type,"#法律咨询");
                break;
        }
        helper.setText(R.id.tv_time,item.pushTime);
    }
}
